#include "StdAfx.h"
#include "SceneManager.h"
#include "CGFunction.h"
SceneManager::SceneManager(void)
{
}

SceneManager::~SceneManager(void)
{
}

BOOL SceneManager::InitData()
{
	CG::CGCheck(InitMapStaticModel());
	return TRUE;
}
BOOL SceneManager::InitMapStaticModel()
{
	const vector<SStaticModel*>* pVecStatic=BaseDataMgr.GetStaticModelVec();
	if (!pVecStatic)
	{
		return FALSE;
	}
	for (vector<SStaticModel*>::const_iterator it=pVecStatic->begin();it!=pVecStatic->end();++it)
	{
		CModel tempModel;
		const SStaticModel *pModel=(*it);
		CG::CGCheck(tempModel.loadModel(DXMgr.getD3DDevice(),pModel->strFileName,pModel->ModelID));
		m_mapStaticModel.insert(pair<INT,CModel>(pModel->ModelID,tempModel));
	}
	return TRUE;
}
void SceneManager::Render()
{
	for (map<int,CModel>::iterator it=m_mapStaticModel.begin();it!=m_mapStaticModel.end();++it)
	{
		(it->second).render(DXMgr.getD3DDevice());
	}
}